package com.lzs.bootsafety.business.logs.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzs.bootsafety.business.logs.entity.SysExc;
import com.lzs.bootsafety.business.logs.mapper.SysExcMapper;
import com.lzs.bootsafety.business.logs.service.SysExcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * @author  zhanshi Liu
 * @date    2020/04/15
 * @website www.jhmsona.cn
 */
@Service
public class SysExcServiceImpl implements SysExcService {
    @Autowired
    private SysExcMapper sysExcMapper;
    @Override
    public int addSelective(SysExc sysExc) {
        return sysExcMapper.insertSelective(sysExc);
    }

    @Override
    public SysExc getByPrimaryKey(Long excId) {
        return sysExcMapper.selectByPrimaryKey(excId);
    }

    @Override
    public PageInfo<SysExc> getSysExc(SysExc sysExc) {
        Integer page = sysExc.getPage();
        Integer limit = sysExc.getLimit();
        PageHelper.startPage(page = page == null ? 1 : page,limit = limit == null ? 10 : limit);
        List<SysExc> moreTableList = sysExcMapper.selectSysExc(sysExc);
        return new PageInfo<SysExc>(moreTableList);

    }
}
